<?php
namespace app\admin\model;

use think\Model;

class Admin extends Model
{
    public $listFilterFields = ['password','salt'];
    public $editFilterFields = ['id', 'salt'];
    public $searchFields = ['username', 'status', 'is_system'];

    public function special($param = [], $save = [])
    {
        if(!($param['id']??false) || $param['password']){
            $save['salt'] = mt_rand(100000, 999999);
            $save['password'] = md5($param['password'].$save['salt']);
        }
        return $save;
    }
}